﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RestSharp;
namespace Ymatou.ServiceCenter
{
    /// <summary>
    /// 服务注册特性，通过此特性标签来告知服务中心该应用（web.config/app.config中的appId）的这某个接口需要对外提供服务
    /// </summary>
    [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
    public class ServiceRegisterAttribute : Attribute
    {
        /// <summary>
        /// 构建服务注册特性
        /// </summary>
        public ServiceRegisterAttribute()
        {

        }

        /// <summary>
        /// 构建服务注册特性
        /// </summary>
        /// <param name="apiName">接口名称</param>
        /// <param name="httpMethod">http方法</param>
        public ServiceRegisterAttribute(string apiName, Method httpMethod)
        {
            this.ApiName = apiName;
            this.HttpMethod = httpMethod;
        }

        /// <summary>
        /// 构建服务注册特性
        /// </summary>
        /// <param name="apiName">接口名称</param>
        /// <param name="httpMethod">http方法</param>
        /// <param name="apiPath">接口的实际调用路径</param>
        /// <param name="description">接口的用途描述</param> 
        /// <param name="owner">接口的拥有者</param> 
        public ServiceRegisterAttribute(string apiName, Method httpMethod, string apiPath, string description, string owner)
        {
            this.ApiName = apiName;
            this.HttpMethod = httpMethod;
            this.ApiPath = apiPath;
            this.Description = description;
            this.Owner = owner;
        }

        /// <summary>
        /// 接口名称
        /// </summary>
        public string ApiName { get; set; }

        /// <summary>
        /// 接口的实际调用路径
        /// </summary>
        public string ApiPath { get; set; }

        /// <summary>
        /// 接口的用途描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 接口的拥有者
        /// </summary>
        public string Owner { get; set; }

        /// <summary>
        /// http方法方法
        /// </summary>
        public Method HttpMethod { get; set; }

    }
}
